class WwController<ApplicationController
  #旺旺插件定时请求，以便查询是否具备最新的快递信息
  def msgflag
    user_id = params[:user_id]
    app_instance_id = params[:app_instance_id]
    hash_code = params[:hash_code]
    domain_login_id = params[:domain_login_id]
    domain_login_id = WWW::Tkd::Gold::Utils::Misc.get_domain_login_id_from_ww domain_login_id

    result = Hash.new
    tb_user = WWW::Tkd::Gold::Model::TbUser.find_by_domain_login_id domain_login_id
    if tb_user==nil
      result['success']=false
      result['msg']='用户不存在'
    else
      exist = WWW::Tkd::Gold::Model::GwtExpress.has_newer_express tb_user,user_id,app_instance_id,hash_code,false
      if exist==nil
        result['success']=false
        result['msg']='安全验证失败'
      else
        result['success']=true
        result['exist']=exist
      end
    end
    if result['success'] && result['exist']
      render :text => "1"
    else
      render :text => "0"
    end
  end
  #显示最新的快递信息
  def view
    user_id = params[:user_id]
    app_instance_id = params[:app_instance_id]
    hash_code = params[:hash_code]
    domain_login_id = params[:domain_login_id]
    domain_login_id = WWW::Tkd::Gold::Utils::Misc.get_domain_login_id_from_ww domain_login_id

    result = Hash.new
    tb_user = WWW::Tkd::Gold::Model::TbUser.find_by_domain_login_id domain_login_id
    if tb_user==nil
      result['success']=false
      result['msg']='用户不存在'
    else
      order = WWW::Tkd::Gold::Model::GwtBuyerOrder.get_last_order tb_user.id
      if order==nil
        result['success']=false
        result['msg']='安全验证失败'
      else
        result['success']=true
        result['order']=order
      end
    end
    @order=result['order']
  end
end
